package be.ipl.finito.domaine;

import java.util.ArrayList;
import java.util.List;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

import be.ipl.finito.domaine.Partie.Etat;
import be.ipl.finito.exceptions.ArgumentInvalideException;
import be.ipl.finito.usecases.GestionPartie;

/**
 * Test les methodes de la classe Partie
 * 
 * @author pej
 * 
 */
public class TestPartie {

	Partie partie;

	@BeforeTest
	public void setUp() {
		partie = new Partie();
	}

	@AfterMethod
	public void tearDown() {
		partie = new Partie();
	}

	@Test
	public void testAjouterPlateau() {
		Plateau p = new Plateau();
		partie.ajouterPlateau(p);
		Assert.assertTrue(partie.getPlateaux().contains(p));
	}

	@Test
	public void testAjouterPlateau1() {
		Plateau p = new Plateau();
		partie.ajouterPlateau(p);
		Assert.assertEquals(partie.getPlateaux().size(), 1);
	}
	
	@Test
	public void testSetPlateaux() {
		Plateau p = new Plateau();
		List<Plateau> pl = new ArrayList<Plateau>();
		pl.add(p);
		partie.setPlateaux(pl);
		Assert.assertTrue(partie.getPlateaux().contains(p));
	}
	
	@Test
	public void testSetEtat() {
		partie.setEtat(Etat.EN_PAUSE);
		Assert.assertEquals(partie.getEtat(), Etat.EN_PAUSE);
	}
}
